#pragma once
#include "eventhandler.h"
#include "Reactor.h"
#include "SOCK_Acceptor.h"

#include "LogEvent.h"
#include <vector>

#define MAX_LOGS 128

namespace Network 
{
	typedef struct LogListItem_
	{
		LogEvent event;
		time_t timestamp;

		LogListItem_(LogEvent event_, time_t timestamp_) : event(event_), timestamp(timestamp_) {} 
	} LogListItem;

	class LoggingEventHandler : EventHandler
	{
		protected:
			SOCK_Acceptor* listener;
			std::vector<LogListItem> logs;
		public:
			LoggingEventHandler(const INET_Addr& ipAddress);
			~LoggingEventHandler() { }

			virtual void handle(unsigned char* data);
			virtual SOCK_Acceptor getHandle() { return *listener; };
			virtual EventType getType(){ return LOG_EVENT; }
	};
}

